//
//  ShopsDetailModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/8.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class ShopsDetailModel: NSObject {
    var merchant_lat = "-999"
    var merchant_mobile = "-999"
    var merchant_lng = "-999"
    var share_data : shareInfoModel?
    var img_count = "-999"
    var merchant_introduce = "暂无"
    var merchant_address = "-999"
    var merchant_name = "-999"
    var merchant_id = "-999"
    var merchant_class_text = "暂无"
    var merchant_worktime = "-999"
    var imgs = [String]()
    
    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "share_data" {
            
            if let temp = value as? [String : AnyObject]{
                
                share_data = shareInfoModel(dic:temp )
                
            }
            
        } else if key == "imgs" {
            
            if let temp = value as? [String] {
                
                for item in temp {
                    
                    imgs.append(item)
                    
                }

                
            }
            
            
            
        }else{
        
        
            super.setValue(value, forKey: key)

        
        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }
    
    
    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["merchant_lat","merchant_mobile","merchant_lng","share_data","img_count","merchant_introduce","merchant_address","merchant_name","merchant_id","merchant_class_text","merchant_worktime","imgs"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }

}
